08. 迷你项目 2

说明

在接下来的迷你项目中,你会将数据集的输入和输出转化为数字。也就是将每个评论字符串转化为向量,将每个标签转化为 01。你要在 notebook 中添加一部分内容,但是要部分就是要实现两个函数,下面是你要实现的函数的函数签名:

def update_input_layer(review):
    """ Modify the global layer_0 to represent the vector form of review.
    The element at a given index of layer_0 should represent \
    how many times the given word occurs in the review.
    Args:
        review(string) - the string of the review
    Returns:
        None
    """
    global layer_0
    # clear out previous state, reset the layer to be all 0s
    layer_0 *= 0
    ## Your code here
    pass
def get_target_for_label(label):
    """Convert a label to `0` or `1`.
    Args:
        label(string) - Either "POSITIVE" or "NEGATIVE".
    Returns:
        `0` or `1`.
    """
    pass

迷你项目 2

Task List:

Task Feedback:

很棒!Andrew 将在下个视频里分享他的解决方案。